package cn.dc406.labc406mgr.mapper;

import cn.dc406.labc406mgr.entity.ApplyTable;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface ApplyMapper {
    @Select("select l.id,i.`name`,i.guige,i.xinghao,i.amount,l.num  from items i join" +
            " lenddetails l where i.id=l.itemid and l.username=#{username} and l.state='0' ORDER BY l.id desc;")
    List<ApplyTable> selectApplyTableByUser(String username);

    @Update("update lenddetails set num=#{num} where id=#{id}")
    int updateLenddetailsById(int num,int id);
    @Update("update lenddetails set applytime=#{applytime},state='1' where id=#{id}")
    int applyItemById(Date applytime, int id);

    @Delete("delete from lenddetails where id=#{id}")
    int deleteLenddetailsById(int id);
}
